package com.example.base_mvvm.base.view;

import android.graphics.Color;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import androidx.databinding.ViewDataBinding;
import androidx.lifecycle.ViewModelProvider;

import com.example.base_mvvm.base.BaseViewModel;

public abstract class BaseView<VDB extends ViewDataBinding,VM extends BaseViewModel>extends AppCompatActivity {
    public VDB dataBinding;
    public VM viewModel;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        dataBinding = DataBindingUtil.setContentView(this,getLayoutId());
        viewModel = new ViewModelProvider(this).get(getViewModel());
        initView();
        getWindow().setStatusBarColor(Color.TRANSPARENT);
        initData();
    }

    protected abstract void initData();

    protected abstract void initView();

    protected abstract Class<VM> getViewModel();

    protected abstract int getLayoutId();
}
